﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimScripts.BF4Rcon.Test
{
    public class PlayerInfoBlockCreator
    {
        List<string> PropertyList = new List<string>();
        List<string> PlayerList = new List<string>();

        public PlayerInfoBlockCreator AddProperties(params string[] properties)
        {
            PropertyList.AddRange(properties);

            return this;
        }

        public PlayerInfoBlockCreator AddPlayers(params string[] players)
        {
            PlayerList.AddRange(players);
            return this;
        }

        public List<string> CreatePlayerInfoBlock(params string[] initialWords)
        {
            List<string> result = new List<string>();

            result.AddRange(initialWords);

            result.Add(PropertyList.Count.ToString());

            result.AddRange(PropertyList);

            result.Add(PlayerList.Count.ToString());

            foreach (string player in PlayerList)
            {
                foreach (string property in PropertyList)
                {
                    if (property.Equals("name"))
                        result.Add(player);
                    else
                        result.Add(string.Empty);
                }
            }

            return result;
        }
    }
}
